package com.gdssoft.pdaweb.model.water;
/*
 *  捷达世软件（深圳）有限公司
 *  Copyright (C) 2008-2010 ShenZhen JieDaShi Software Limited Company.
*/
import java.util.Date;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.google.gson.annotations.Expose;

/**
 * PdaWaterList Base Java Bean, base class for the.oa.model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 * 
 */
public class PdaWaterList extends com.gdssoft.core.model.BaseModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Expose
    protected Long id;
	@Expose
	protected String amId;
	@Expose
	protected Long degree;
	@Expose
	protected String recorderId;
	@Expose
	protected String month;
	@Expose
	protected Date recordTime;
	@Expose
	protected String updataId;
	@Expose
	protected String updateDate;
	@Expose
	protected String remark;
	@Expose
	protected String createddt;
	@Expose
	protected String createdby;
	@Expose
	protected String lasteditdt;
	@Expose
	protected String lasteditby;
	@Expose
	protected String status;
	@Expose
	protected Long lastDegree;

	@Expose
	protected Integer transcribeType;
	/***
	 * 上月修正量
	 */
	protected Long fixedUsage;
	protected String Comments;

	protected PdaWaterMeter pdaWaterMeter;

	protected Integer toCrmFlag;
	

	/**
	 * 本月用量 = 本月读数 + 修正量 - 上月读数
	 * @return
	 */
	public Long getUsage() {
		long fix = getFixedUsage() == null? 0 : getFixedUsage(); //修正量为空置为0
		long last = (getLastDegree()==null||getLastDegree() == -1) ? 0 : getLastDegree(); //上月读数为空置为0
		long degree=getDegree()==null? 0 : getDegree();
		return degree+ fix - last ;
	}

	/**
	 * Default Empty Constructor for class PdaWaterList
	 */
	public PdaWaterList () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class PdaWaterList
	 */
	public PdaWaterList (
		 Long in_id
        ) {
		this.setId(in_id);
    }

    

	/**
	 * 	 * @return String
	 * @hibernate.property column="METER_ID" type="java.lang.String" length="13" not-null="true" unique="false"
	 */
	public String getAmId() {
		return this.amId;
	}
	
	/**
	 * Set the amId
	 * @spring.validator type="required"
	 */	
	public void setAmId(String aValue) {
		this.amId = aValue;
	}	

	/**
	 * 	 * @return Long
	 * @hibernate.property column="DEGREE" type="java.lang.Long" length="22" not-null="true" unique="false"
	 */
	public Long getDegree() {
		return this.degree;
	}
	
	/**
	 * Set the degree
	 * @spring.validator type="required"
	 */	
	public void setDegree(Long aValue) {
		this.degree = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="RECORDER_ID" type="java.lang.String" length="10" not-null="false" unique="false"
	 */
	public String getRecorderId() {
		return this.recorderId;
	}
	
	/**
	 * Set the recorderId
	 */	
	public void setRecorderId(String aValue) {
		this.recorderId = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="MONTH" type="java.lang.String" length="7" not-null="false" unique="false"
	 */
	public String getMonth() {
		return this.month;
	}
	
	/**
	 * Set the month
	 */	
	public void setMonth(String aValue) {
		this.month = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="RECORD_TIME" type="java.util.Date" length="50" not-null="false" unique="false"
	 */
	public Date getRecordTime() {
		return this.recordTime;
	}
	
	/**
	 * Set the recordTime
	 */	
	public void setRecordTime(Date aValue) {
		this.recordTime = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="UPDATA_ID" type="java.lang.String" length="10" not-null="false" unique="false"
	 */
	public String getUpdataId() {
		return this.updataId;
	}
	
	/**
	 * Set the updataId
	 */	
	public void setUpdataId(String aValue) {
		this.updataId = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="UPDATE_DATE" type="java.lang.String" length="50" not-null="false" unique="false"
	 */
	public String getUpdateDate() {
		return this.updateDate;
	}
	
	/**
	 * Set the updateDate
	 */	
	public void setUpdateDate(String aValue) {
		this.updateDate = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="REMARK" type="java.lang.String" length="50" not-null="false" unique="false"
	 */
	public String getRemark() {
		return this.remark;
	}
	
	/**
	 * Set the remark
	 */	
	public void setRemark(String aValue) {
		this.remark = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="CREATEDDT" type="java.lang.String" length="50" not-null="false" unique="false"
	 */
	public String getCreateddt() {
		return this.createddt;
	}
	
	/**
	 * Set the createddt
	 */	
	public void setCreateddt(String aValue) {
		this.createddt = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="CREATEDBY" type="java.lang.String" length="20" not-null="false" unique="false"
	 */
	public String getCreatedby() {
		return this.createdby;
	}
	
	/**
	 * Set the createdby
	 */	
	public void setCreatedby(String aValue) {
		this.createdby = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="LASTEDITDT" type="java.lang.String" length="50" not-null="false" unique="false"
	 */
	public String getLasteditdt() {
		return this.lasteditdt;
	}
	
	/**
	 * Set the lasteditdt
	 */	
	public void setLasteditdt(String aValue) {
		this.lasteditdt = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="LASTEDITBY" type="java.lang.String" length="20" not-null="false" unique="false"
	 */
	public String getLasteditby() {
		return this.lasteditby;
	}
	
	/**
	 * Set the lasteditby
	 */	
	public void setLasteditby(String aValue) {
		this.lasteditby = aValue;
	}	

	/**
	 * 	 * @return Long
     * @hibernate.id column="ID" type="java.lang.Long" generator-class="native"
	 */
	public Long getId() {
		return this.id;
	}
	
	/**
	 * Set the id
	 */	
	public void setId(Long aValue) {
		this.id = aValue;
	}	

	/**
	 * 	 * @return String
	 * @hibernate.property column="IS_NAMOL" type="java.lang.String" length="1" not-null="true" unique="false"
	 */
	public String getStatus() {
		return this.status;
	}
	
	/**
	 * Set the status
	 * @spring.validator type="required"
	 */	
	public void setStatus(String aValue) {
		this.status = aValue;
	}	

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof PdaWaterList)) {
			return false;
		}
		PdaWaterList rhs = (PdaWaterList) object;
		return new EqualsBuilder()
				.append(this.amId, rhs.amId)
				.append(this.degree, rhs.degree)
				.append(this.recorderId, rhs.recorderId)
				.append(this.month, rhs.month)
				.append(this.recordTime, rhs.recordTime)
				.append(this.updataId, rhs.updataId)
				.append(this.updateDate, rhs.updateDate)
				.append(this.remark, rhs.remark)
				.append(this.createddt, rhs.createddt)
				.append(this.createdby, rhs.createdby)
				.append(this.lasteditdt, rhs.lasteditdt)
				.append(this.lasteditby, rhs.lasteditby)
				.append(this.id, rhs.id)
				.append(this.status, rhs.status)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.amId) 
				.append(this.degree) 
				.append(this.recorderId) 
				.append(this.month) 
				.append(this.recordTime) 
				.append(this.updataId) 
				.append(this.updateDate) 
				.append(this.remark) 
				.append(this.createddt) 
				.append(this.createdby) 
				.append(this.lasteditdt) 
				.append(this.lasteditby) 
				.append(this.id) 
				.append(this.status) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("amId", this.amId) 
				.append("degree", this.degree) 
				.append("recorderId", this.recorderId) 
				.append("month", this.month) 
				.append("recordTime", this.recordTime) 
				.append("updataId", this.updataId) 
				.append("updateDate", this.updateDate) 
				.append("remark", this.remark) 
				.append("createddt", this.createddt) 
				.append("createdby", this.createdby) 
				.append("lasteditdt", this.lasteditdt) 
				.append("lasteditby", this.lasteditby) 
				.append("id", this.id) 
				.append("isNamol", this.status) 
				.toString();
	}

	/**
	 * @return the lastDegree
	 */
	public Long getLastDegree() {
		return lastDegree;
	}

	/**
	 * @param lastDegree the lastDegree to set
	 */
	public void setLastDegree(Long lastDegree) {
		this.lastDegree = lastDegree;
	}

	/**
	 * @return the pdaWaterMeter
	 */
	public PdaWaterMeter getPdaWaterMeter() {
		return pdaWaterMeter;
	}

	/**
	 * @param pdaWaterMeter the pdaWaterMeter to set
	 */
	public void setPdaWaterMeter(PdaWaterMeter pdaWaterMeter) {
		this.pdaWaterMeter = pdaWaterMeter;
	}
	public Long getFixedUsage() {
		if (null == fixedUsage)
			return 0L;
		else
			return fixedUsage;
	}
	public void setFixedUsage(Long fixedUsage) {
		this.fixedUsage = fixedUsage;
	}
	public String getComments() {
		return Comments;
	}
	public void setComments(String comments) {
		Comments = comments;
	}


	public Integer getToCrmFlag() {
		return toCrmFlag;
	}

	public void setToCrmFlag(Integer toCrmFlag) {
		this.toCrmFlag = toCrmFlag;
	}

	public Integer getTranscribeType() {
		return transcribeType;
	}

	public void setTranscribeType(Integer transcribeType) {
		this.transcribeType = transcribeType;
	}


}
